﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
using DAO;
using DTO;
namespace Banking.Member
{
    public partial class frmThayDoiMatKhau : Form
    {
        private TaiKhoanDangNhap tk;
        public frmThayDoiMatKhau()
        {
            InitializeComponent();
        }
        public void init(TaiKhoanDangNhap t)
        {
            tk = t;
            txtTenTruyCap.Text = tk.MaTK.ToString();
        }

        private void btnLuu_Click(object sender, EventArgs e)
        {
            if (txtMatKhauCu.Text == tk.MatKhau)
            {
                TaiKhoanDangNhapDA.ThayDoiMatKhau(tk.MaTK, txtMaKhauMoi.Text,2);
                MessageBox.Show("Thay đổi mật khẩu  thành công", "BankingSystem", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.DialogResult = System.Windows.Forms.DialogResult.OK;
            }
            else
            {
                MessageBox.Show("Mat khau cu sai ", "BankingSystem", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                txtMatKhauCu.Text = "";
            }   
            
         }

        private void btnHuy_Click(object sender, EventArgs e)
        {
            Close();
        }


    }
}
